Overview
With the Saxon upgrade to 12.x HE, customers must now implement custom XSLT external functions as Saxon extension-function classes.
Changes in Saxon 12.x HE
-
Customers must extend net.sf.saxon.lib.ExtensionFunctionDefinition to implement external functions.
-
Functions are defined through a structured contract: QName, argument count or argument types, return type, and runtime call logic.
Required Function Structure
Each custom XSLT external function must be written as a Java class that extends net.sf.saxon.lib.ExtensionFunctionDefinition. The example snippets below use no-argument GUID function named as getNextGUID.
Note: The getNextGUID example uses a no-argument function. Functions with arguments must define the appropriate argument types in getArgumentTypes().
Package Declaration
New extension-function classes should use should use one of the following packages:
-
com.adminserver.helper, or
-
com.adminserver.dal.helper.
| package com.adminserver.helper; |
Class Declaration
The class must extend ExtensionFunctionDefinition so that Saxon can discover the function contract and the runtime call implementation.
import net.sf.saxon.lib.ExtensionFunctionDefinition; public class GetNextGUIDFunction extends ExtensionFunctionDefinition {// Function contract methods are implemented here. } |